package com.adcc.loadsheet.billing.vo;

import com.adcc.loadsheet.billing.entity.contractuser.ContractUserEntity;
import com.adcc.loadsheet.billing.entity.permission.PermissionEntity;
import com.adcc.loadsheet.billing.vo.contractuser.ContractUserType;

/**
 * tree
 * Created by zhaoml on 2020/9/22.
 */
public class TreeVO {
    //节点ID
    private String id;
    //父节点ID
    private String pId;
    //节点名称
    private String name;
    //节点是否打开
    private Boolean open;
    //节点是否选中
    private Boolean checked;
    //是否是父节点(默认传null即可)
    private Boolean isParent;
    //图标
    private String icon;

    //关联用户
    public TreeVO(ContractUserEntity contractUserEntity, Boolean open, Boolean isParent){
        if(contractUserEntity.getUserType().equals(1)){
            this.pId = ContractUserType.AIRPORT.toString();
        }else {
            this.pId = ContractUserType.AIRLINES.toString();
        }
        this.id = contractUserEntity.getContractUserId().toString();
        this.isParent = isParent;
        this.name = contractUserEntity.getUserAbbrev();
        this.open = open;
    }

    //权限
    public TreeVO(PermissionEntity permissionEntity, Boolean open, Boolean isParent){
        this.id = permissionEntity.getFunctionPermissionId().toString();
        this.pId = permissionEntity.getParentPermissionId().toString();
        this.isParent = isParent;
        this.name = permissionEntity.getPermissionDescription();
        this.open = open;
    }

    public TreeVO(String id, String pId, String name, Boolean open, Boolean isParent){
        this.id = id;
        this.pId = pId;
        this.name = name;
        this.open = open;
        this.isParent = isParent;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public Boolean getIsParent() {
        return isParent;
    }

    public void setIsParent(Boolean isParent) {
        this.isParent = isParent;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }
}